package a3;

import java.util.AbstractMap.SimpleEntry;
import java.util.HashMap;
import java.util.Iterator;
import java.util.TreeSet;
import java.util.Vector;

public class Q {
	private float defaultvalue;
	HashMap<String, Float> Q = new HashMap<String, Float>();

	public Q(float defaultvalue)
	{
		this.defaultvalue = defaultvalue;
	}
	
	public Float get(SimpleEntry<State,Action> saPair)
	{
		if( Q.containsKey(saPair.toString()))
		{
			return Q.get(saPair.toString());
		}
		else
		{
			return defaultvalue;
		}
	}
	
	public void set(SimpleEntry<State, Action> saPair, Float value)
	{
		Q.put(saPair.toString(), value);
	}
	
	public void clear()
	{
		Q = new HashMap<String, Float>();
	}
}
